Repository navigation
Conversation
4 tasks done
…rator sign-in Implements ADR 0011: a React and Vite app in ui/, built into dist/ui and served in front of app.fetch with the CSP and cache headers; sign-in with an operator token kept per tab; the shell with its navigation; status.get's daemon.consoleUrl, printed by simlock status and daemon start; a Playwright browser lane in Chromium, Firefox and WebKit; CONSOLE.md and DESIGN.md. Closes #271
V3RON
added a commit
that referenced
this pull request
Oct 3, 2026
Closes #272 Stacked on #289 (#271). The console now has live data and the Workers pages. - **Live data layer** (`ui/src/live/`). `LiveConnection` follows `GET /v1/events/stream` read with `fetch`, refetches every route the screen reads on each event and every second, with one request per route in flight. It marks the console disconnected on a network failure, a 10 s timeout, a closed stream or 40 s of silence, then asks `/v1/healthz` after 1, 2, 4, 8 s and every 10 s. The clock offset comes from the `Date` header. A hidden tab closes the stream and stops polling. Views use `useLiveResource(path)`, `useNow()` and `useConnection()`. `useLiveEvents` and `useStreamOpened` are there for the events view. - **Views**: the workers list and one worker's page (devices, host, catalog, installs), and a connection line under the header. A `501 UNSUPPORTED_IN_WORKER_MODE` shows "Not available on a single host". - **Spec gap**: the worker view has no time-in-state for `ready`, `quarantined` or `shutdown` devices, so those show `—`. - `docs/CONSOLE.md`, `DESIGN.md` and `ARCHITECTURE.md` are updated. Known failure: `instance-identity` "racing to write the first identity" also fails on the base. ## Done when - [x] A gateway with two fake-driver workers matches `simlock worker list`, and a lease taken with the CLI shows within a second. Checked by the browser tests "on a gateway, every worker…" and "a granted lease shows on the worker within a second". The second starts when the gateway's own `GET /v1/workers` has the lease. - [x] A single host shows one worker with the same views. Checked by "on a single host, the workers view shows one worker". Every detail test runs on a single host. - [x] Stopping and starting the daemon follows ADR 0013 §5. Checked by unit tests for each disconnect cause, the backoff, recovery and "starting", and by the stop and start browser tests. - [x] The browser lane passes in Chromium, Firefox and WebKit: `pnpm test:console` passed 93 of 93, and 558 of 558 with `--repeat-each 6`. ## Review Spec review: 8 findings, 3 fixed; second round 9 findings, 2 fixed. Code review: 15 findings, 15 fixed; second round 10 findings, 8 fixed. Rejected: - Time in state is missing for `ready`, `quarantined` and `shutdown` devices. The worker view has no time for them, and the spec allows no contract change. Spec needs: the time each device entered its state, on status devices. - The "within a second" tests start counting when the gateway's own data has the change. The console cannot show a fact before its daemon has it, and the gateway took 3 to 12 ms. - The unit test "durations use the clock offset…" checks only `serverNow()`. The device browser test now checks shown durations with the browser clock set 3 hours ahead. - The shell keyboard test skips controls inside `#main`. The workers view adds links there, and the test covers the shell's own controls. - `useLiveEvents` and `useStreamOpened` have no caller yet. The spec says later views use this layer, and #276 uses them. - `DESIGN.md` and `ARCHITECTURE.md` are not named in the spec. Architecture rule 13 requires updating the docs a change affects, and `DESIGN.md` must change with the styles. - While the daemon is starting, a timeout retries rather than disconnecting. ADR 0011 §6 and 0013 §5 call a daemon whose `/v1/healthz` answers but whose reads wait "starting". A network failure still disconnects. - A tab shown again while disconnected asks `/v1/healthz` at once. ADR 0013 §3 says a shown tab catches up at once, and the backoff was paused while the tab was hidden. - A worker that reconnects can show a long time in state until the gateway refreshes it. That refresh follows the connect within milliseconds. Restack note: #288 now keeps `worker.list`'s catalog for 30 seconds, so `docs/CONSOLE.md` says the Workers page's catalog is read again after a component install and otherwise every 30 seconds (commit `docs(ui): say when the Workers page's catalog is read again`). *Written by an agent.*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #271
Stacked on #288 (
task/270).With
http.enabled, the daemon serves a web console at/in both modes. An operator signs in with an operator token and sees the shell: header, navigation for Workers, Leases, Waiting, Attention and Events (each "Coming soon"), and Sign out.simlock statusanddaemon startprintConsole: <url>, from the new optionalstatus.getfielddaemon.consoleUrl.ui/: React + Vite app, built intodist/uibypnpm build. Views and nav entries are one list inui/src/views/index.tsx. Data goes throughui/src/api.ts: same origin, bearer token, 10 s timeout, and a401signs out.src/http/server.ts: servesdist/uiin front ofapp.fetchwith the ADR 0011 CSP and cache headers. Console requests skip the request log, and the daemon warns once at start when the console is not built.pnpm test:console: a Playwright lane in Chromium, Firefox and WebKit, with a new CI job.docs/CONSOLE.md(user) anddocs/internal/DESIGN.md(style guide).src/core/instance-identity.test.ts› "hands every daemon racing to write the first identity the same one" fails on this machine. It fails the same way on the base commit (task/270), so it is not from this change.Done when
pnpm buildproducesdist/ui, and the packed tarball contains it. Checked withpnpm build, thenpnpm pack --dry-run, which listsdist/ui/index.htmland its assets.simlock statusprints shows the sign-in screen, on a gateway and on a single host. Covered by the browser lane'sservingtests ande2e/console-serving.test.ts.sign-intests. The "starting" and "unreachable" states are inui/src/sign-in-check.test.ts.the page makes no request to any host but the daemon, which also fails on any CSP violation.docs/CONSOLE.mdanddocs/internal/DESIGN.mdexist and match what was built.Review
Spec review: 14 findings, 5 fixed. Code review: 14 findings, 13 fixed.
Rejected:
/v1/healthz. The daemon always answers that route with 200, so any other answer there (a proxy's 502) means the daemon was not reached./assets/with no extension answers 404 rather than the page. Serving the page there gaveindex.htmlan immutable cache and answered a missing asset with the page, against ADR 0011 §3 and §4.GET /v1/workerson mount. ADR 0011 §6 says a 401 at any time signs out; this call is how a revoked token is signed out on reload. It shows no data..fallowrc.json, and a favicon were not asked for. README lists every end-user doc. The doc edits fix claims this change made false. The fallow entries and the favicon are what the new files need.docs/internal/agent-rules/documentation.mdgainsdocs/CONSOLE.md. Rule 2 names every end-user doc it covers, so a new one joins the list (architecture rule 13).server.tsimportsnode:fs(raised twice, once per review). ADR 0011 §3 puts file serving inserver.ts, the impure HTTP adapter, which already reads the disk throughserveStatic.Written by an agent.